package com.jian.utils;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;

public class InternetUtils
{
	/**
	 * 检测网络状态
	 * 
	 * @param context
	 */

	public static void NetWorkIsEnable(Context context)
	{
		ConnectivityManager mConnectivityManager = (ConnectivityManager) context
				.getSystemService(Context.CONNECTIVITY_SERVICE);
		NetworkInfo mNetworkInfo = mConnectivityManager.getActiveNetworkInfo();
		if (null != mNetworkInfo) {
			int type = mNetworkInfo.getType();
			if (ConnectivityManager.TYPE_MOBILE == type) { // 3g 4g 2g
//				Constants.internetstate = 0;
			} else if (ConnectivityManager.TYPE_WIFI == type) {
//				Constants.internetstate = 1;// wifi
			} else {
//				Constants.internetstate = 1;// wifi
			}
		} else {
//			Constants.internetstate = -1;
		}

	}
}
